package net.yla.smartbus.core.util.date;

import java.util.Calendar;
import java.util.Date;

/**
 * @Author : 默苍离
 * @Create_Date : 2020/10/27/16:08
 * @Pack_name : net.yla.smartbus.module.oc.check.util : YseterdayAndTomorrow
 * *****************************************************
 * 注释:获取 昨天 明天 日期 工具类
 */
public class YesterdayAndTomorrow {

    /**
     * 返回昨天
     *
     * @param today
     * @return
     */
    public static Date yesterday(Date today) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(today);
        calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 1);
        return calendar.getTime();
    }


    /**
     * 返回明天
     *
     * @param today
     * @return
     */
    public static Date tomorrow(Date today) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(today);
        calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) + 1);
        return calendar.getTime();
    }

}
